Incorporating Stylistic Variations Into Shape Geometries
When you draw a shape, QuickDraw GX applies the information in the style object of the shape to the shape's geometry. For example, style objects contain a pen width property, described in full later in this chapter. When you draw a line shape, QuickDraw GX draws the line with the width specified in the pen width property of the style object associated with the line shape. As drawn, the thick line looks like a filled polygon. However, even after drawing the line shape, the shape still contains a line geometry.QuickDraw GX provides a mechanism for incorporating the stylistic variations contained in a style object directly into the geometry of a shape object. This mechanism is the
GXPrimitiveShape
function, which is described in full in the next chapter, "Geometric Operations."If you make changes to a shape's style object and then call the
GXPrimitiveShape
function, QuickDraw GX changes the shape's shape type, shape fill, and shape geometry to incorporate the new stylistic variations. Basically, the same process that happens when drawing the shape happens directly to the shape's geometry.For example, Figure 3-3 shows a line shape. If you alter the style of this line shape to include a pen width of 10, the line shape effectively becomes a filled polygon shape.
If you were to apply the
GXPrimitiveShape
function to this thick line shape, theGXPrimitiveShape
function would change the shape type to the polygon type, the shape fill to even-odd shape fill, and the shape geometry to a list of the four geometric points that define the polygon, as shown in Figure 3-3.Another example, the result of applying the
GXPrimitiveShape
function to a framed rectangle with a thick pen width is shown in Figure 3-4. In this case, the result of theGXPrimitiveShape
function is a filled polygon shape with two contours: an inside contour and an outside contour.Figure 3-3 Effects of the
GXPrimitiveShape
function on a line shape
Figure 3-4 Effects of the
GXPrimitiveShape
function on a rectangle shape
Notice that the
GXPrimitiveShape
function does not affect the style object of the shape: it merely incorporates the existing style information into the geometry of the shape.The result of calling the
GXPrimitiveShape
function is called a primitive shape, or a shape in its primitive form. Primitive shapes include
QuickDraw GX uses primitive shapes for caps, joins, dashes, and patterns, which are discussed throughout the rest of this chapter, and for clip shapes, which are discussed in the chapter "Transform Objects" in Inside Macintosh: QuickDraw GX Objects.
- empty shapes and full shapes, which are described in Chapter 3, "Geometric Shapes"
- filled rectangle, polygon, and path shapes, which are also described in Chapter 3, "Geometric Shapes"
- hairline framed shapes, which are described on page 3-16
- glyph shapes, which are described in Inside Macintosh: QuickDraw GX Typography
- bitmap shapes, which are described in Chapter 5, "Bitmap Shapes"
Main | Page One | What's New | Apple Computer, Inc. | Find It | Contact Us | Help